﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Profari_Heldur_Utan_Um_Prof
{
    public partial class CreateQuestionnaire : Form
    {
        string intro;
        
        private static SqlConnection con = new SqlConnection("Data Source=AZAZEAL-THINK\\SQLEXPRESS;Initial Catalog=dto1;Integrated Security=True " +
  "Initial Catalog=TestDB;Integrated Security=True");
        public CreateQuestionnaire()
        {
            InitializeComponent();
        }

        private void btnFinish_Click(object sender, EventArgs e)
        {
            intro = richTextBox1.Text;
            con.Open();
            SqlCommand cmd = new SqlCommand("Insert INTO Questionnaire(intro)" + "VALUES(@intro)", con);
            con.Close();

            System.Threading.Thread testerInterface = new System.Threading.Thread(new System.Threading.ThreadStart(OpenTesterInterface));
            testerInterface.SetApartmentState(System.Threading.ApartmentState.STA);
            testerInterface.Start();
            this.Close();
        }

        public static void OpenTesterInterface()
        {
            Application.Run(new TesterInterface());
        }
    }
}
